<!DOCTYPE html>
<html lang='en'>

<head>
    <meta charset='UTF-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Document</title>
    <script src='./vue.global.js'></script>
</head>

<body>
    <div id='app'>
        <my-component v-model.capitalize="myText"></my-component>
        {{myText}}
    </div>
    <script>
        const app = Vue.createApp({
            data() {
                return {
                    myText: "abc"
                }
            }
        })

        app.component('my-component', {
            props: {
                modelValue: String,
                modelModifiers: {
                    default: () => ({})
                }
            },
            emits: ['update:modelValue'],
            
            methods: {
                handleInput(e) {
                    let value = e.target.value
                    if(this.modelModifiers.capitalize){
                        value = value.charAt(0).toUpperCase() + value.slice(1)
                    }

                    this.$emit('update:modelValue', value)
                }
            },
            template: `
                <input type="text"
                :value="modelValue"
                @input="handleInput">
            `,
            created() {
                console.log(this.modelModifiers) // { capitalize: true }
            }
        })

        const vm = app.mount('#app')
    </script>
</body>

</html>